!{include file='common/iheader.htm'}
<div id="i_nav">
	<h3 class="page_title">WIKI管理</h3>
	<a class="button" href="/manager.php?app=wiki&act=recommend&type=0">引用管理</a>
	<a class="button" href="/manager.php?app=spider&act=wiki_list">未归类图片管理</a>
	<a class="button" href="/manager.php?app=spider&act=w">Wiki爬虫</a>
</div>
<form id="wiki_form" method="post" action="/manager.php?app=wiki&act=used">
	<ul class="list_view">
		!{foreach from=$dicts item=dict key=id}
		<li id="w_!{$id}">
			<strong><label><input type="checkbox" name="wiki[]" value="!{$id}"> !{$dict.word}</label></strong>
			<div class="opt_div">
				<a href="javascript:void(0)" onclick="del('!{$id}')">删除词条</a>
				<a href="/manager.php?app=wiki&act=edit&id=!{$id}">编辑框架</a>
				<a href="/manager.php?app=wiki&act=image_list&id=!{$id}">编辑图片</a>
				<a href="/wiki/!{$dict.word}" target="_blank">预览</a>
				<a href="javascript:void(0);" onclick="clean_cache('!{$dict.word}')">清除缓存</a>
			</div>
		</li>
		!{foreachelse}
		<li>
			<strong>暂无记录...</strong>
		</li>
		!{/foreach}
	</ul>
	<div class="option_div">
		!{html_options name="word_type" options=$types}
		<input type="button" value="设置" class="button submit_btn">
		<div class="pager">
			!{include file='common/pager.htm'}
		</div>
	</div>
</form>
<script>
	function clean_cache(word){
		$.post('/manager.php?app=wiki&act=clean_cache',{
			word : word
		}, function(data){
			var json = eval('(' + data + ')');
			alert(json.info);
		});
	}
	
	function del(id){
		if(confirm('是否继续删除此词条？')){
			$.get('/manager.php?app=wiki&act=del_wiki&id=' + id, function(data){
				var json = eval('(' + data + ')');
				alert(json.info);
				if(json.result){
					$('#w_' + id).remove();
				}
			});
		}
	}
	
	$(function(){
		$('.submit_btn').click(function(){
			if(!$('input[name="wiki[]"]:checked').length){
				alert('您尚未选择要引用的词条！');
				return;
			}
			$('#wiki_form').submit();
		});
	});
</script>
!{include file='common/ifooter.htm'}